package com.project.rfidpage.controller;


import com.github.pagehelper.PageInfo;
import com.project.rfidpage.aop.TagLog;
import com.project.rfidpage.dto.RidLivParam;
import com.project.rfidpage.dto.RidTidLivParam;
import com.project.rfidpage.service.RidLivService;
import com.project.rfidpage.util.RestResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/rfidpage/ridliv/")
public class RidLivController extends BaseController {

    @Resource
    RidLivService ridLivService;

    /**
     * 列表查询
     */
    @PostMapping("page")
    @TagLog(operation = 0, content = "查询基站运转情况列表")
    public RestResult page(@RequestBody RidLivParam param) {
        this.getPage(true, param);
        return RestResult.ok(new PageInfo<>(ridLivService.getListForPage(param)));
    }

    /**
     * 导出列表
     */
    @PostMapping("output")
    @TagLog(operation = 5, content = "导出基站运转情况列表")
    public RestResult output(@RequestBody RidLivParam param) {
        this.getPage(false, param);
        return RestResult.ok(ridLivService.getListForPage(param));
    }

    /**
     * 电子标签位置分布列表查询
     */
    @PostMapping("tid/page")
    @TagLog(operation = 0, content = "查询电子标签位置分布列表")
    public RestResult tidPage(@RequestBody RidTidLivParam param) {
        this.getPage(true, param);
        return RestResult.ok(new PageInfo<>(ridLivService.getTidListForPage(param)));
    }

    /**
     * 电子标签位置分布详细列表查询
     */
    @PostMapping("tid/detail")
    @TagLog(operation = 0, content = "查询电子标签位置分布详细列表")
    public RestResult tidDetailPage(@RequestBody RidTidLivParam param) {
        this.getPage(false, param);
        return RestResult.ok(ridLivService.getDetialListByBgno(param));
    }
}
